package com.fy56.platform.logistics.controller;

import com.fy56.platform.logistics.common.BaseController;
import com.fy56.platform.logistics.model.User;
import com.fy56.platform.logistics.service.web.IUserService;
import com.fy56.platform.logistics.utils.SessionUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * 用户信息controller
 * Created by li on 2018-02-09.
 */
@SuppressWarnings("ALL")
@RestController
@RequestMapping("/controller/user")
public class UserController extends BaseController {

    @Autowired
    private IUserService iUserService;

    /**
     * 获取根据用户中心的user,获取当前登陆人person,html页面使用 fy_api.login_person
     *
     * @param keyId
     * @return
     */
    @RequestMapping(value = "getLoginUser", method = RequestMethod.POST)
    @ResponseBody
    public User getLoginUser(Integer userId, HttpServletRequest request){
        User user = new User();
        user.initInsert(SessionUtil.getSessionUser(request));
        return user;
    }

    @RequestMapping(value = "updateSelective", method = RequestMethod.POST)
    @ResponseBody
    public User getLoginUser(User user, HttpServletRequest request){
        user.initInsert(SessionUtil.getSessionUser(request));
        return user;
    }

}
